const app = getApp()
import {
  showMsg
} from '../../../../../utils/config.js'
import {
  reqConsumerRoomList
} from '../../../../../request/api.js'
Component({
  properties: {
    show: false,
    roleId: {
      type: Number,
      value: 2
    },
    Name:{
      type:String,
      value:'完成'
    }
  },

  data: {
    dataList: [{
      id:2,
      name:"管理员",
      description:"管理设备和房间 | 管理成员"
    },{
      id:3,
      name:"普通成员",
      description:"使用设备 | 查看成员"
    }],
    roomItemInfo: {
      id:2
    },
  },

  observers: {
    show(val) {
      console.log(this.data.roleId,'11');
      this.setData({
        'roomItemInfo.id':this.data.roleId
      })
    }
  },
  async attached() {


  },
  detached() {},

  methods: {
    itemClick(e) {
      // console.log(e,'111');
      // let type = e.type
      // let id = ''
      // if (type == 'change') {
      //   id == e.detail
      // } else {
      //   id = e.target.dataset.id
      // }
      // let {
      //   dataList
      // } = this.data
      // let roomItemInfo = {}
      // dataList.forEach(item => {
      //   if (item.id === id) {
      //     roomItemInfo = item
      //   }
      // })
      // this.setData({
      //   roomItemInfo
      // })
    },

    itemClick1(e) {
      console.log(e,'e');
      let {
        item
      } = e.currentTarget.dataset
      this.setData({
        roomItemInfo: item,
      })
    },

    confirm() {
      this.triggerEvent('confirmRoomSelection', {
        action: 'confirm',
        roomInfo: this.data.roomItemInfo
      });
    },

    onClose() {
      this.triggerEvent('confirmRoomSelection', {
        action: 'cancel',
      });
    },

  }
})